import React from 'react';
import { Descriptions, Empty } from 'antd';
import { isEmpty, keys, map } from 'lodash/fp';

export default function EnvVarDescription({ dataSource }) {
  return (
    isEmpty(dataSource)
      ? (<Empty description="暂无数据" />)
      : (
        <Descriptions bordered column={1}>
          {
            map((key) => (
              <Descriptions.Item label={key} span={3} key={key}>
                {dataSource[key]}
              </Descriptions.Item>
            ), keys(dataSource))
          }
        </Descriptions>
      )
  );
}
